package com.hgd.igreencar.biz.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hgd.igreencar.biz.IWebsiteUsersBiz;
import com.hgd.igreencar.dao.WebsiteUsersMapper;
import com.hgd.igreencar.entity.WebsiteUsers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WebSiteUsersBiz implements IWebsiteUsersBiz {
    @Autowired
    private WebsiteUsersMapper usersMapper;

    @Override
    public WebsiteUsers login(WebsiteUsers users){
        return usersMapper.getOne(users);
    }//登录


    @Override
    public WebsiteUsers queryOne(int userId) {
        return usersMapper.queryOne(userId);
    }//查询单个用户

    @Override
    public int save(WebsiteUsers users) {
        return usersMapper.save(users);
    }//新增用户

    @Override
    public PageInfo queryUserAll(String jurisdictionName, int currentPage,int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        PageInfo pageInfo = new PageInfo(usersMapper.queryUserAll(jurisdictionName,currentPage, pageSize));
        return pageInfo;
    }//查询所有用户

    @Override
    public int delete(int userId) {
        return usersMapper.delete(userId);
    }//删除用户

    @Override
    public int editUser(WebsiteUsers users) {
        return usersMapper.editUser(users);
    }//编辑用户
}
